package org.itboys.framework.spring.editor;

import org.bson.types.ObjectId;

import java.beans.PropertyEditorSupport;


public class ObjectIdEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        setValue(ObjectId.isValid(text) ? new ObjectId(text) : null);
    }
}
